import { useState } from "react"
function Dog() {
    let [isBarking,setIsBarking]= useState(false)
    let [isRunning,setIsRunning]= useState(false)
    const handleClick=()=>{
        // DOM编程已经一去不复返了
        setIsBarking(true)
        setIsRunning(true)
        setTimeout(() => {
            setIsBarking(false)
            setIsRunning(false)
        }, 2000);
    }
    return(
        // JSX
        // 动态的 有多个状态
        <div onClick={handleClick}>
            <div>Dog</div>
            {/* <p>{isBarking?'www':''}</p>*/}
            <p>{isBarking && 'www'}</p>
            <p>{isRunning && 'rrr'}</p>
        </div>
    )
}

export default Dog